<? if($_SESSION['is_login'] != true){ reHome($urlHome);} ?>
 <script language="javascript">
 	function checkChangePass(){
		var a = document.getElementById('txtOldPassword');
		var b = document.getElementById('txtNewPassword');
		var c = document.getElementById('txtNewPasswordConfirm');
		
		if(a.value == ""){
			alert('Mật khẩu không được để trống !');
			a.focus();
			return false;
		}
		if(b.value == ""){
			alert('Mật khẩu không được để trống !');
			b.focus();
			return false;
		}
		if(c.value == ""){
			alert('Mật khẩu không được để trống !');
			c.focus();
			return false;
		}
		if(b.value != c.value){
			alert('Mật khẩu xác thực không đúng !');
			c.value="";
			c.focus();
			return false;
		}
		
	}
 </script>
 <?
 	$mess = "";
 	if(isset($_POST['submit'])){
		$txtOldPassword = md5($_POST['txtOldPassword']);
		$txtNewPassword = md5($_POST['txtNewPassword']);
		$uid = $_SESSION['uid'];
		$rs = $db->query("SELECT * FROM ".$prefix."nguoidung WHERE u_pass = '".$txtOldPassword."' AND u_id = '".$uid."'");
		if($db->num_rows($rs) != 0){
			$db->query("UPDATE ".$prefix."nguoidung SET u_pass = '".$txtNewPassword."' WHERE u_id = '".$uid."'");
		}else{
			$mess = "Mật khẩu cũ bạn nhập sai !";
		}
	}
 ?>
 <div id="linkPath">
        

<div class="linkPath">
    <div class="corner-round-01-top-right">
        <div class="corner-round-01-top-left">
            <div class="corner-round-01-top-bg"></div>
        </div>

    </div>
    <div class="corner-round-01-body">    
         <?
		   	file_exist('includes/inc_thong_tin_rieng.php');
			include('includes/inc_thong_tin_rieng.php');
	   ?>

        <div style="clear: both;"></div>
    </div>
    <div class="corner-round-01-bottom-right">
        <div class="corner-round-01-bottom-left">
            <div class="corner-round-01-bottom-bg"></div>
        </div>
    </div>   
</div>
    </div>
<form action="" name="frmChangePassword" id="frmChangePassword" method="post" onsubmit="return(checkChangePass());">
    <!-- Main Page-Content { -->
    <div id="page-content">
        
<div id="userChangePassword">
    <div class="corner-round-02-top-right">
        <div class="corner-round-02-top-left">
            <div class="corner-round-02-top-bg"></div>
        </div>
    </div>
    
    <div class="corner-round-02-body">

    <div class="userChangePassword" style="overflow:hidden;height:auto;">
	        <h3 class="form-header">Thay đổi mật khẩu</h3>
		    <p class="form-line"></p>
		    <div class="field">
				
			    <label>Tên tài khoản</label><?=$_SESSION['uname']?>			    
		    </div>

		    
		    <div class="field">
			    <label>Mật khẩu cũ</label>
			    <input id="txtOldPassword" name="txtOldPassword" type="password" maxlength="50" />				
		    </div>
		    
		    <div class="field">
			    <label>Mật khẩu mới</label>
			    <input id="txtNewPassword" name="txtNewPassword" type="password" maxlength="50" />
		    </div>

		    
		    <div class="field">
			    <label>Nhập lại mật khẩu mới</label>
			    <input id="txtNewPasswordConfirm" type="password" maxlength="50" />
		    </div>
		    <div class="field">
			    <label>&nbsp;</label>
			    <input id="accept" name="accept" type="image" class="img" src="<?=$root?>/themes/images/form/button-accept.jpg" />
				<?
					if($mess != ""){
				?>
				<span align="center" style="font-weight:bold; color:#FF0000;"><?=$mess?></span>
				<? } ?>
		    </div>

        </div>
    </div> 
       
    <div class="corner-round-02-bottom-right">
        <div class="corner-round-02-bottom-left">
            <div class="corner-round-02-bottom-bg"></div>
        </div>
    </div>   
</div>

    </div>

    <div style="clear:both;"></div>      
    <!-- } Main Page-Content -->
	<input type="hidden" name="submit" id="submit" value="submit" />
</form>
            </div>
